{extend name="public/base" /}
{block name='content'}
{include file='public/content_header' /}
<!--数据列表页面-->
<section class="content">

    <!--顶部搜索筛选-->
<div class="row">
    <div class="col-md-12">
        <div class="card">
            <div class="card-header dataSearch">
                <form class="form-inline searchForm" id="searchForm" action="{:url('index')}" method="GET">

                    <div class="input-group input-group-sm searchGroup">
                        <input value="{$_keywords ? $_keywords : '' ;}"
                               name="_keywords" id="_keywords" class="form-control input-sm" placeholder="ID">
                    </div>
                    <div class="input-group input-group-sm searchGroup smallSelect">
    <select name="project_id" id="project_id" class="form-control input-sm index-search">
        <option value="">项目</option>
        {foreach name='project_list' id='item'}
        <option value="{$item.id}" {if isset($project_id) && ''!==$project_id && $project_id==$item.id}selected{/if}>{$item.title}</option>
        {/foreach}
    </select>
</div>
<script>
    $(function () {
        $('#project_id').select2({
        width:'100%'
        });
    });
</script>
<div class="input-group input-group-sm searchGroup smallSelect">
    <select name="user_id" id="user_id" class="form-control input-sm index-search">
        <option value="">公司</option>
        {foreach name='user_list' id='item'}
        <option value="{$item.id}" {if isset($user_id) && ''!==$user_id && $user_id==$item.id}selected{/if}>{$item.username}</option>
        {/foreach}
    </select>
</div>
<script>
    $(function () {
        $('#user_id').select2({
        width:'100%'
        });
    });
</script>
<div class="input-group input-group-sm searchGroup smallSelect">
                        <select name="status" id="status" class="form-control input-sm index-search">
                            <option value="">状态</option>
                            {foreach $status_list as $key=>$value}
                            <option value="{$key}" {if isset($status) && ''!==$status && $status==$key}selected{/if}>{$value}</option>
                            {/foreach}
                        </select>
                    </div>
                    <script>
                        $(function () {
                            $('#status').select2({
                            width:'100%'
                            });
                        });
                    </script>
<div class="input-group input-group-sm searchGroup">
    <input value="{$create_time|default=''}" readonly name="create_time" id="create_time" class="form-control input-sm indexSearchDatetimeRange" placeholder="报价时间">
</div>
<script>
    laydate.render({
        elem: '#create_time',
        type: 'datetime',
        range: true,
    });
</script>

                    <div class="form-group smallSelect">
    <select name="_order" id="_order" class="form-control input-sm index-order">
        <option value="">排序字段</option>
        <option value="id" {if isset($_order) && $_order=='id'}selected{/if}>ID</option>
        <option value="create_time" {if isset($_order) && $_order=='create_time'}selected{/if}>报价时间</option>
        <option value="all_money" {if isset($_order) && $_order=='all_money'}selected{/if}>总价</option>
    </select>
</div>

<div class="form-group smallSelect">
    <select name="_by" id="_by" class="form-control input-sm index-order">
        <option value="">排序方式</option>
        <option value="desc" {if isset($_by) && $_by=='desc'}selected{/if}>倒序</option>
        <option value="asc" {if isset($_by) && $_by=='asc'}selected{/if}>正序</option>
    </select>
</div>
<script>
    $('#_order').select2();
    $('#_by').select2();
</script>

                    <div class="form-group searchGroup">
                        <button class="btn btn-sm btn-primary" type="submit"><i class="fa fa-search"></i> 查询
                        </button>
                    </div>
                    
                    <div class="form-group searchGroup">
                        <button onclick="clearSearchForm()" class="btn btn-sm btn-default" type="button"><i
                                class="fa  fa-eraser"></i> 清空查询
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

    

    <div class="row">
        <div class="col-md-12">
            <div class="card">

                <!--数据列表顶部-->
                <div class="card-header">
                    <div>
                        <a class="btn flat btn-sm btn-default BackButton">
                            <i class="fas fa-arrow-left"></i>
                            返回
                        </a>
                        <button class="btn btn-warning btn-sm AjaxButton" data-toggle="tooltip" title="作废选中数据" data-confirm-title="作废确认" data-confirm-content="您确定要作废选中的数据吗？" data-id="checked" data-url="{:url('disable')}">
    <i class="fas fa-ban"></i> 作废
</button>
                        
                        <button class="btn btn-default btn-sm ReloadButton" data-toggle="tooltip" title="刷新列表数据">
    <i class="fas fa-redo"></i> 刷新
</button>
                    </div>
                </div>

                <div class="card-body table-responsive p-0" >
                    <table class="table table-hover table-bordered dataTable text-nowrap">
                        <thead>
                        <tr>
                            <th>
    <input id="dataCheckAll" type="checkbox" onclick="checkAll(this)" class="checkbox" placeholder="全选/取消">
</th>
                                        <th>ID</th>
            <th>项目</th>
            <th>公司</th>
            <th>总价</th>
            <th>状态</th>
            <th>报价时间</th>

                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {foreach name='data' id='item' key='data_key'}
                        <tr>
                            <td>
    <input type="checkbox" onclick="checkThis(this)" name="dataCheckbox" data-id="{$item.id}" class="checkbox dataListCheck" value="{$item.id}" placeholder="选择/取消">
</td>
                                        <td>{$item.id}</td>
            <td>{$item.project.title|default=''}</td>
            <td>{$item.user.nickname|default=''}</td>
            <td>{$item.all_money}</td>
            <td>{$item.status_name}</td>
            <td>{$item.create_time}</td>

                            <td class="td-do">
                                <a href="{:url('info',['id'=>$item.id])}"
                                   class="btn btn-primary btn-xs" title="详情" data-toggle="tooltip">
                                    <i class="fas fa-eye"></i>
                                    
                                </a>

                                {if $item.status==2}
                                <!--<a href="{:url('send/add2',['project_log_id'=>$item.id])}"-->
                                <!--   class="btn btn-primary btn-xs" title="生成采购单" data-toggle="tooltip">-->
                                <!--    <i class="fas fa-plus"></i>-->
                                    
                                <!--</a>-->
                                <a href="{:url('export',['id'=>$item.id])}"
                                   class="btn btn-primary btn-xs" title="导出" data-toggle="tooltip">
                                    <i class="fas fa-file-export"></i>
                                    
                                </a>
                                {/if}
                                {if $item.status!=3}
<button class="btn btn-warning btn-xs AjaxButton" data-toggle="tooltip" title="作废"  data-id="{$item.id}" data-confirm-title="作废确认" data-confirm-content='您确定要作废ID为 <span class="text-red">{$item.id}</span> 的数据吗' data-url="{:url('disable')}">
    <i class="fas fa-ban"></i>
    作废
</button>
{/if}
                                
                            </td>
                        </tr>
                        {/foreach}
                        </tbody>
                    </table>
                </div>

                <!-- 数据列表底部 -->
                <div class="card-footer">
                    {$page|raw}
                    {include file='public/change_page' /}
                </div>

            </div>
        </div>
    </div>
</section>
{/block}
